﻿class messageBox extends MovieClip{
	
	
	
	var txt:TextField;
	
	var timer:Number = 0;
	
	function messageBox(){
		
		
		onLoad = Init;
		
	}
	
	function Init(){
		
		txt = this["sub"]._txt;
		
		
	}
	
	
	function showMessage(_msg:String, _time:Number){
		trace("showMessage : " + _msg);
		this.gotoAndPlay("show");
		
		
		txt.text = _msg;
		
		timer = _time + 30;
		onEnterFrame = runTimer;
		
	}
	
	function runTimer(){
		timer--;
		//trace("text timer " + timer);
		
		
		if(timer == 0){
			this.gotoAndPlay("hide");
			delete onEnterFrame;
		}
		
	}
	
	
}